function [A] = Amatrix_time(x,mdl)
% this funtion creates the A matrix for different models, using the parameters in the vector (x)

if mdl == 1
    dm = [-x(3)-x(4)-x(5)-x(6); -x(4)-x(5)-2*x(6)]; dm = [dm; flip(dm)];
    d = [-5*x(1); -x(3)-x(4)-x(6); dm; -x(3)-x(5)-x(6); -5*x(2)];
    d1 = [x(1); x(3); x(3); x(6); x(6); x(6); x(5)+x(6)];
    d_1 = [x(4) + x(6); x(6); x(6); x(6); x(3); x(3); x(2)];
    A = eye(8,8) + diag(d) + diag(d1,1) + diag(d_1,-1);
    A(3:6,1) = x(4)*ones(4,1); A(3:6,8) = x(5)*ones(4,1); A(1,3:6) = x(1)*ones(1,4); A(8,3:6) = x(2)*ones(1,4);
elseif mdl == 3
    dm = [-x(3)-x(4)-x(5)-x(6); -x(4)-x(5)-2*x(6)]; dm = [dm; flip(dm)];
    d = [-5*x(1); -x(3)-x(4)-x(6); dm; -x(3)-x(5)-x(6); -5*x(2)];
    d1 = [x(1); x(3); x(3); x(6); x(6); x(6); x(5)+x(6)];
    d_1 = [x(4) + x(6); x(6); x(6); x(6); x(3); x(3); x(2)];
    A = eye(8,8) + diag(d) + diag(d1,1) + diag(d_1,-1);
    A(3:6,1) = x(4)*ones(4,1); A(3:6,8) = x(5)*ones(4,1); A(1,3:6) = x(1)*ones(1,4); A(8,3:6) = x(2)*ones(1,4);
end

end
